﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using System.Collections.Generic;
using TerminologiaSinacor.Presenter;

public partial class page_PesquisaGlossarioChave : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void BtnPesquisar_Click(object sender, EventArgs e)
    {
        Glossario glossario = new Glossario();
        glossario.NomeTermo = this.TxtPalavraChave.Text;

        this.ViewState["GlossarioFiltro"] = glossario;
        BindingGrid(glossario); 
    }

    //20080723 17:16 - Alterado - DSales.7Comm
    private void BindingGrid(Glossario glossario)
    {
        //-->  Esta chamada eh esclusisva para a regra de negócio "Pesquisa de Termo de Glossário por palavra chave."
        List<Glossario> glossarios = new List<Glossario>();
        glossarios = glossario.searchKey(glossario.NomeTermo);
        GrdGlossario.DataSource = glossarios;
        GrdGlossario.DataBind();
    }

    //20080723 17:16 - Alterado - DSales.7Comm
    protected void GrdGlossario_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        Glossario glossario = (Glossario)ViewState["GlossarioFiltro"];
        this.GrdGlossario.PageIndex = e.NewPageIndex;
        BindingGrid(glossario);
    }

    /// Data:23/07/2008 14:17
    /// Autor:DSales.7Comm
    /// Obs: Eventos para efeito do mouseOver,MouseOut e click
    protected void GrdGlossario_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Attributes.Add("onMouseOver", "this.style.backgroundColor='#DAA520';");
            e.Row.Attributes.Add("onMouseOut", "this.style.backgroundColor='#ffffff'");
        }
    }
}
